<template>
	<div class="banner-wrap">
		<el-carousel :interval="5000" arrow="always" height="500px">
			<el-carousel-item v-for="(imgSrc, index) in imgsList" :key="index">
				<img :src="imgSrc" />
			</el-carousel-item>
		</el-carousel>
	</div>
</template>
<script>
// 引入请求
import { getBanner } from "@/api";
export default {
	name: "BannerPart",
	data() {
		return {
			imgsList: [],//初始值
		};
	},
	created() {
		this.getBanner();//页面初始化的时候获取数据
	},
	methods: {
		async getBanner() {
			let result = await getBanner();
			// console.log(result);
			this.imgsList.push(...result.data);
		},
	},
};
</script>
<style scoped lang="scss">
.banner-wrap {
	border-radius: 6px;
	margin-bottom: 30px;
	overflow: hidden;
}
</style>
